Some METAFONT Techniques
نویسنده
چکیده
This paper presents a few ideas on how to solve certain geometrical problems arising very often in character design, not directly solvable by METAFONTs plain macros. The first part of the paper presents two geometrical problems: the “k problem” and the “x problem”, their solutions using dichotomy, and a different solution using path intersections. The latter was proposed earlier on the net by the author; although geometrically correct, it does not work in real-world METAFONT practice: a nice example of METAFONT code : : : to avoid. The second part of the paper presents two simple macro for drawing “loose” Bézier curves; in a sense, the opposite of the tension operator. Finally, the third part solves a problem stated by Alan Hoenig: how to extract text and data out of aMETAFONT run, without using the log file. This is done in a straightforward manner by running a Flex-generated preprocessor over the GF file: the Flex code for this utility is given in appendix B. 1 Two Geometrical Problems, Solved by Iterated Calculations 1.1 Description Suppose you want to design a character ‘K’, as on the left part of fig. 1. The character should fit inside a box of width w and height h, and should consist of three strokes: the vertical stroke z0 z00 , and the two oblique strokes z1 z2 and z10 z20 . Only constraint: the point z1l = z10r should be fixed (for example, its coordinates can be (0; h2 )). So, here is the problem: Find a stroke z1 z2 with fixed z1l; y2l; x2r . This problem is not trivial, because METAFONT cannot compute pen positions without knowing in advance the angle of the pen (this stands both for defining a new pen with command pickup pen as for defining a simulated pen with command penpos). Because it arises when designing the letter ‘K’, we will call this problem, the “k problem”. The next problem is encountered when designing an ‘X’: as on the right part of fig. 1, suppose you want to draw this letter. Once again it should fit inside the box, and should consist of two strokes. To keep the same notation as in the previous case, we have only given names to the pen positions concerning the upper right part of the letter. In this case the constraints are: z1 is fixed (and not z1l as in the previous case), as well as y2l and x2r. Here again is the problem, which we call the “x problem”: Find a stroke z1 z2 with fixed z1; y2l; x2r. Well understood, in both cases the direction of the stroke must be perpendicular to the angle of the pen: all strokes must keep the same width.
منابع مشابه
Graphics and T E X | a Reappraisal Of
It is all about the author's rst steps in METAFONT, to create graphics for inclusion in TEX documents, with a wink to MetaPost and : : :PostScript. The graphics comprises graphs of math functions, 2-D pictures and 2.5-D images of 3-D objects via projection techniques; 4-D for varying viewing angles is touched upon. Some highlights on macro writing in METAFONT have been selected, and the appendi...
متن کاملGraphics and TEX—a reappraisal of METAFONT/MetaPost
It is all about the author’s first steps in METAFONT, for creating graphics to be included in TEX documents, with a wink to MetaPost. The graphics comprises 2D pictures and 2.5D images of 3D objects via projection techniques. Learning METAFONT was much easier than learning TEX. Included examples are: cat, Hilbert curve, and Gabo’s linear construction in space no 2. A few highlights on macro wri...
متن کاملReverse Digital Typography
Reverse engineering of typefaces has been an active research area of digital typography. However, past research works are limited to typographic parameters extraction and curve fitting, and no reverse-engineering equivalent of any classical digital typesetting software (e.g. METAFONT compiler, LTEX package) exist to date. Interestingly, the rise of cloud computing has made large scale reverse t...
متن کاملDreamboat Floating Point Numbers and Metafont, Metapost, T E X, and Postscript Type 1 Fonts
Some features related to METAFONT, METAPOST, and TEX, concerning the ability of such programs to perform calculations, are discussed and the opportunity, not to mention the necessity, of extending these programs to handle real numbers with floating points calculations is strongly (and hopefully) suggested.
متن کاملPr ep rin t 25 Years of TEX and METAFONT : Looking Back and Looking Forward : TUG ’ 2003
TEX has lasted longer than many other computer software technologies. This article reviews some of the history of TEX and METAFONT, how they have come to be used in practice, and what their impact has been on document markup, the Internet, and publishing. TEX has several design deficiencies that limit its use and its audience. We look at what TEX did right, and with 25 years of hindsight, what ...
متن کامل